import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class AgreementService extends BaseService<any> {
  private readonly logger = new Logger(AgreementService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getList
   * 对应 PHP: AgreementService_admin::getList()
   * 逻辑类型: undefined - undefined
   */
  async getList() {
    // 基于PHP真实逻辑: getList
    // PHP原文: $type = AgreementDict::getType();         $list = [];         foreach ($type as $k => $v)         {             $list[$k] = $this->getAgreement($k);  ...
const type = AgreementDict.getType(];
        const list = [);
        foreach (type as k => v)
        {
            list[k] = this.getAgreement(k];
            list[k).type_name = v;
  }

  /**
   * getAgreement
   * 对应 PHP: AgreementService_admin::getAgreement()
   * 逻辑类型: undefined - undefined
   */
  async getAgreement(key: string) {
    // 基于PHP真实逻辑: getAgreement
    // PHP原文: return (new CoreAgreementService())->getAgreement($this->site_id, $key);     }      /**      * 设置协议      * @param string $key      * @param string $ti...
return this.coreAgreementService.getAgreement(this.site_id, key);
    }

    /**
     * 设置协议
     * @param string key
     * @param string title
     * @param string content
     * @return bool
     */
    async setAgreement(string key, string title, string content)
    {
        return this.coreAgreementService.setAgreement(this.site_id, key, title, content);
    }
}
  }

  /**
   * setAgreement
   * 对应 PHP: AgreementService_admin::setAgreement()
   * 逻辑类型: undefined - undefined
   */
  async setAgreement(key: string, title: string, content: string) {
    // 基于PHP真实逻辑: setAgreement
    // PHP原文: return (new CoreAgreementService())->setAgreement($this->site_id, $key, $title, $content);     } }...
return this.coreAgreementService.setAgreement(this.site_id, key, title, content);
    }
}
  }
}
